home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Pascal Sample 3.0B10 / Read Me - Sample < prev   
Encoding:
Text File  |  1993-10-13  |  5.8 KB  |  121 lines  |  [TEXT/MPS ]

  1. This is an evolution of the original traffic light Sample, circa 1988.  This version
  2. requires 6.0.7 or later and supports the following features:
  3.  
  4. •    Multiple documents
  5. •    Changeable document content
  6. •    Correct human interface for changing document content
  7. •    Handles the four required Apple Events
  8. •    Supports stationery
  9. •    Decent memory management
  10. •    A preferences file and editable preferences
  11. •    Works with both MPW and THINK Pascal
  12.  
  13. Although this release is complete, it has version 3.0b10 because there is a version
  14. in C coming.  Some of the same files will be used and revised for that version, and
  15. I have this phobia about changing a component without changing the version number.
  16. The C version will be a routine-for-routine translation of this version, and when
  17. that's done, the version will be 3.0.  (It seems everyone did their own 2.0 version
  18. of this, so we officially skipped it.)  The C version will compile with universal
  19. headers for PowerPC development.
  20.  
  21. For directions on using Sample with THINK Pascal, see the end of this file.
  22.  
  23. ----
  24. This section is for people who've seen the previous version of Sample.
  25.  
  26. Your first reaction is probably "YOW!", followed soon by "Who the heck are you,
  27. and what did you do to this Sample?  It used to be small and understandable,
  28. and now it's big and huge and large."
  29.  
  30. Well, it's not that big, but it's a lot larger than it used to be.  So is the
  31. Macintosh, which is most of the reason.
  32.  
  33. This started out a couple of years ago when I was still new to Macintosh, but
  34. not to Desktop, programming.  Some people had asked for some updates to the
  35. traffic light sample, and it seemed like a decent learning project for someone
  36. needing to refine his Macintosh skills.
  37.  
  38. The list of things to do wasn't very large:
  39.  
  40. •  Support the four required Apple events
  41. •  Have preferences
  42. •  Support only 6.0.7 and later (dump code checking for 5.x systems and earlier)
  43. •  Always use the proper human interface and compatibility guidelines, including
  44.    supporting localization and international markets
  45.    
  46. I didn't think this would be a big deal, even though I'd never written a multiple-
  47. document application before.  I knew _how_, I just hadn't done it.  Silly boy.
  48.  
  49. The first requirement was the real killer.  To support open and print events
  50. properly, you have to have documents.  If you have documents, they have to have
  51. distinguishable content -- they shouldn't all look alike.  If the user can modify
  52. the content, there has to be a workable user interface.
  53.  
  54. If you save files, you have to have icon suites.  This alone has taken years on
  55. some projects.
  56.  
  57. So, in between doing my normal work, I worked on this.  I started in Pascal
  58. because I wasn't fully fluent in either Pascal or C at the time, and I had to
  59. look up less Pascal to get code written.  Besides, the Pascal compiler catches
  60. a lot of errors that the C compiler will let through, and for a learner, that's
  61. a very good thing.  I write almost all in C these days, but I kept plugging on this,
  62. refining the interface and structure until basically my manager said "Ship it or
  63. we're going to do something evil to you."
  64.  
  65. So here it is.  I could hack on this forever -- adding the Apple Event Object Model,
  66. scriptability, QuickDraw GX support, mailer support, etc.  I will add some of this
  67. stuff as time goes by, but as it stands, it's a pretty decent little sample.  It
  68. could be a shell for a small application, though that's not exactly what it's
  69. intended for.  There are other, more robust shells available for those purposes.
  70. This sample just shows how one person built a Macintosh application almost from
  71. scratch and tried to keep it modular so he could reuse some of the code later.
  72.  
  73. I invite your comments to AppleLink address DEVSUPPORT, or DEATHERAGE1.
  74.  
  75. ---
  76.  
  77. How to make this run under THINK Pascal:
  78.  
  79. Much of this sample was developed under THINK Pascal, though the last month or so
  80. of development was under MPW.  MPW Pascal has some things going for it, including
  81. the "-u" option which sets all uninitialized variables to $7267, which makes it
  82. easy to find them in debugging.  Very cool.
  83.  
  84. THINK Pascal automatically manages UNITs correctly -- if you change something in
  85. a UNIT's INTERFACE, all code which USES that UNIT is rebuilt.  If you change
  86. something in the IMPLEMENTATION, only that UNIT is rebuilt.  MPW doesn't have
  87. this concept, so it's done by placing the IMPLEMENTATION in a separate source
  88. file that's included by the main file.  This is how the files and the makefile
  89. are structure.
  90.  
  91. THINK Pascal doesn't support included files, or some of the MPW Pascal directives.
  92. Therefore, it's _very_ important that you follow these steps to get the source
  93. building under THINK Pascal.
  94.  
  95. 1.     USE THE GENERIC SCRIPT OF THE PASCAL SOURCE CONVERTER SUPPLIED WITH THINK PASCAL
  96.     TO CONVERT THE SOURCE FILES TO THINK FORMAT.  If you don't do this, all the
  97.     comments will be formatted poorly (MPW allows comments to span lines), the
  98.     directives will not be correct, and the files won't build.  Using this one
  99.     simple step fixes all this, so thank Symantec for their kindness.
  100.     
  101. 2.    BUILD A PROJECT FILE.  One is enclosed that you can use, although you might have
  102.     to tell THINK Pascal where some of the interface files are.  If you do, be
  103.     sure to pick the interfaces in the THINK folder, and not other versions.  THINK
  104.     has many definitions built into the compiler, and picking later, conflicting
  105.     interface files for the project can confuse things.
  106.     
  107. 3.  DEFINE SystemSixOrLater TO TRUE IN THE PROJECT FILE.  This makes the right
  108.     interfaces compile in some cases.
  109.     
  110. 4.    USE SAREZ TO BUILD THE RESOURCE FILE FOR THE PROJECT.  If you'd prefer to use
  111.     a resource editor, build it once and use the resource editor.  A built version
  112.     of just the resource file is enclosed.  Name it "Sample.rsrc" for the project
  113.     file supplied.
  114.     
  115. That's it -- the project is ready to build and run!
  116.  
  117. ---
  118.  
  119. Matt Deatherage
  120. Developer Support Center
  121. October, 1993